﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dingding.Helper;

namespace DingApi
{
    public partial class WebApi : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string mobile  = Request.QueryString["mobile"];
            string colname = Request.QueryString["colname"];


            if ((!string.IsNullOrEmpty(mobile))
                && (!string.IsNullOrEmpty(colname))
                )
            {


                //EI.EIInfo inBlock = new EI.EIInfo();

                //inBlock.Tables[0].Columns.Add("MOBILE");
                //inBlock.Tables[0].Columns.Add("COLNAME");

                //inBlock.Tables[0].Rows.Add();
                //inBlock.Tables[0].Rows[0]["MOBILE"] = mobile;
                //inBlock.Tables[0].Rows[0]["COLNAME"] = colname;




                //// 调用后台services保存信息
                //EI.EIInfo outBlock = EI.EITuxedo.CallService("kszz31_inq", inBlock);
                //if (outBlock.sys_info.flag != 0)
                //{
                    
                //    return;
                //}




                //string sql = " select  " + colname + " as value ,to_char(to_date(REC_CREATE_TIME,'yyyymmddhh24miss'),'MM-dd')  as  name  ";
                //sql += "from tkszz31   ";
                //sql += " where archive_flag = ' ' and  MOBILE='" + mobile + "' ";
                //sql += " order by REC_CREATE_TIME ";


                string sql = " select to_char(to_date(REC_CREATE_TIME,'yyyymmddhh24miss'),'MM-dd')  as  name ,";
                sql += " FIELD_NA 体重kg, 	FIELD_N1 BMI, 	FIELD_N2 脂肪率, 	FIELD_N5 肌肉率, 	FIELD_N8 骨骼肌率, 	FIELD_N10 蛋白质, 	FIELD_N11 水分, 	FIELD_N12 骨量, 	FIELD_N14 身体年龄, 	FIELD_N15 健康评分 ";

                sql += " from tkszz31   ";
                sql += " where archive_flag = ' ' and  MOBILE='" + mobile + "' ";
                sql += " order by REC_CREATE_TIME ";


                	


                EI.EIInfo outBlock = EF.Utility.ExecQuery(sql);
                
                if (outBlock.sys_info.flag == 0)
                {
                    Response.Write(JsonHelper.GetJson(outBlock));
                }

                else
                {
                    Response.Write(JsonHelper.GetJson(outBlock.sys_info.msg));

                }
                Response.End();
            }


        



           

          

        }

      
    }
}